def solve(s):
    n = len(s)
    if n == 0:
        return 0
    i, j = 0, 0
    res = 1
    while j < n:
        while s[j] in s[i:j]:
            i += 1
        res = max(res, j - i + 1)
        j+=1

    return res


if __name__ == "__main__":
    s = "abcabcbb"
    print(solve(s))
